home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWString / Include / FWStrgAr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-08  |  5.5 KB  |  165 lines  |  [TEXT/MPS ]

  1. #ifndef FWSTRGAR_H
  2. #define FWSTRGAR_H
  3. //========================================================================================
  4. //
  5. //    File:                FWStrgAr.h
  6. //    Release Version:    $ 1.0d11 $
  7. //
  8. //    Copyright:    (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef FWSTRING_H
  13. #include "FWString.h"
  14. #endif
  15.  
  16. #ifndef FWSTREAM_H
  17. #include "FWStream.h"
  18. #endif
  19.  
  20. #if FW_LIB_EXPORT_PRAGMAS
  21. #pragma lib_export on
  22. #endif
  23.  
  24. //========================================================================================
  25. //    CLASS FW_CStringArchiver
  26. //========================================================================================
  27.  
  28. class FW_CLASS_ATTR FW_CStringArchiver
  29. {
  30. public:
  31.  
  32.     static void Read(FW_CReadableStream & archive,
  33.                         FW_CString &string);
  34.  
  35.     static void Write(FW_CWritableStream & archive, 
  36.                       const FW_CString &string);
  37. };
  38.  
  39. //========================================================================================
  40. //    class FW_CDynamicStringArchiver
  41. //========================================================================================
  42.  
  43. class FW_CLASS_ATTR FW_CDynamicStringArchiver
  44. {
  45.  
  46. public:
  47.  
  48.     static void * Read(FW_CReadableStream & archive);
  49.         // Read function for FW_REGISTER_ARCHIVABLE_CLASS macro.
  50.  
  51.     static void Write(FW_CWritableStream & archive, 
  52.                       const void *object);
  53.         // Write function for FW_REGISTER_ARCHIVABLE_CLASS macro.
  54. };
  55.  
  56. //========================================================================================
  57. //    class FW_CString32Archiver
  58. //========================================================================================
  59.  
  60. class FW_CLASS_ATTR FW_CString32Archiver
  61. {
  62.  
  63. public:
  64.  
  65.     static void * Read(FW_CReadableStream & archive);
  66.         // Read function for FW_REGISTER_ARCHIVABLE_CLASS macro.
  67.  
  68.     static void Write(FW_CWritableStream & archive, 
  69.                       const void *object);
  70.         // Write function for FW_REGISTER_ARCHIVABLE_CLASS macro.
  71. };
  72.  
  73. //========================================================================================
  74. //    class FW_CString255Archiver
  75. //========================================================================================
  76.  
  77. class FW_CLASS_ATTR FW_CString255Archiver
  78. {
  79.  
  80. public:
  81.  
  82.     static void * Read(FW_CReadableStream & archive);
  83.         // Read function for FW_REGISTER_ARCHIVABLE_CLASS macro.
  84.  
  85.     static void Write(FW_CWritableStream & archive, 
  86.                       const void *object);
  87.         // Write function for FW_REGISTER_ARCHIVABLE_CLASS macro.
  88. };
  89.  
  90. //========================================================================================
  91. // FW_InitializeStrings
  92. //========================================================================================
  93.  
  94. void FW_InitializeStrings(void);
  95.  
  96. //========================================================================================
  97. // Static archiving
  98. //========================================================================================
  99.  
  100. //########################################################################################
  101. // SCpp Hack
  102. // Work around SCpp 8.0.3 bug - importing overloaded functions doesn't work.
  103. // Replace overloaded functions with normal functions with different names.
  104. // Use inline overloaded functions which turn around and call the renamed
  105. // functions so client code isn't affected.
  106. //########################################################################################
  107.  
  108. #if 0
  109.  
  110. FW_FUNC_ATTR FW_CReadableStream& operator>>(FW_CReadableStream& stream, FW_CDynamicString& string);
  111. FW_FUNC_ATTR FW_CReadableStream& operator>>(FW_CReadableStream& stream, FW_CString32& string);
  112. FW_FUNC_ATTR FW_CReadableStream& operator>>(FW_CReadableStream& stream, FW_CString255& string);
  113.  
  114. FW_FUNC_ATTR FW_CWritableStream& operator<<(FW_CWritableStream& stream, const FW_CDynamicString& string);
  115. FW_FUNC_ATTR FW_CWritableStream& operator<<(FW_CWritableStream& stream, const FW_CString32& string);
  116. FW_FUNC_ATTR FW_CWritableStream& operator<<(FW_CWritableStream& stream, const FW_CString255& string);
  117.  
  118. #else
  119.  
  120. FW_FUNC_ATTR FW_CReadableStream& _FW_StreamInDynamic (FW_CReadableStream& stream, FW_CDynamicString& string);
  121. FW_FUNC_ATTR FW_CReadableStream& _FW_StreamInStr32 (FW_CReadableStream& stream, FW_CString32& string);
  122. FW_FUNC_ATTR FW_CReadableStream& _FW_StreamInStr255 (FW_CReadableStream& stream, FW_CString255& string);
  123.  
  124. FW_FUNC_ATTR FW_CWritableStream& _FW_StreamOutDynamic (FW_CWritableStream& stream, const FW_CDynamicString& string);
  125. FW_FUNC_ATTR FW_CWritableStream& _FW_StreamOutStr32 (FW_CWritableStream& stream, const FW_CString32& string);
  126. FW_FUNC_ATTR FW_CWritableStream& _FW_StreamOutStr255 (FW_CWritableStream& stream, const FW_CString255& string);
  127.  
  128. #endif
  129.  
  130. #if FW_LIB_EXPORT_PRAGMAS
  131. #pragma lib_export off
  132. #endif
  133.  
  134. #if 1
  135.  
  136. inline FW_CReadableStream& operator>>(FW_CReadableStream& stream, FW_CDynamicString& string) {
  137.     return _FW_StreamInDynamic (stream, string);
  138. }
  139.  
  140. inline FW_CReadableStream& operator>>(FW_CReadableStream& stream, FW_CString32& string) {
  141.     return _FW_StreamInStr32 (stream, string);
  142. }
  143.  
  144. inline FW_CReadableStream& operator>>(FW_CReadableStream& stream, FW_CString255& string) {
  145.     return _FW_StreamInStr255 (stream, string);
  146. }
  147.  
  148.  
  149. inline FW_CWritableStream& operator<<(FW_CWritableStream& stream, const FW_CDynamicString& string) {
  150.     return _FW_StreamOutDynamic (stream, string);
  151. }
  152.  
  153. inline FW_CWritableStream& operator<<(FW_CWritableStream& stream, const FW_CString32& string) {
  154.     return _FW_StreamOutStr32 (stream, string);
  155. }
  156.  
  157. inline FW_CWritableStream& operator<<(FW_CWritableStream& stream, const FW_CString255& string) {
  158.     return _FW_StreamOutStr255 (stream, string);
  159. }
  160.  
  161. #endif
  162.  
  163. #endif
  164.  
  165.